home *** CD-ROM | disk | FTP | other *** search
- /* CancelEvent.ged by Troels Walsted Hansen
- ** $VER: CancelEvent.ged v1.00 (09.06.95)
- **
- ** Run this script when aborting an event in GoldED. The script will
- ** quit GoldED without saving and delete the event in THOR.
- */
-
- options results
-
- /* needs GoldED, THOR and bbsread.library functions */
-
- if(substr(address(),1,6) ~= "GOLDED") then
- do
- say "This script should only be started from inside GoldED."
- exit 20
- end
- else gedport = address()
-
- p = ' ' || address() || ' ' || show('P',,)
- thorport = pos(' THOR.',p)
-
- if thorport > 0 then thorport = word(substr(p,thorport+1),1)
- else
- do
- say 'No THOR port found!'
- exit 10
- end
-
- if ~show('p', 'BBSREAD') then
- do
- address command
- "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
- "WaitForPort BBSREAD"
- end
-
- /* quit without saving */
-
- address(gedport)
- QUERY FILE VAR filename
- QUIT NOSAVE
-
- address(thorport)
- CURRENTBBS stem CURRENT
- if(rc ~= 0 | CURRENT.BBSNAME ~= "") then bbs = CURRENT.BBSNAME
- else exit
-
- /* traverse eventlist to find the correct message event */
-
- address(bbsread)
- GETBBSDATA '"'bbs'"' stem BBSDATA
- if(rc ~= 0) then
- do
- address(thorport)
- REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
- exit 5
- end
-
- do i=BBSDATA.FIRSTEVENT to BBSDATA.LASTEVENT
- drop MSGTAGS.
-
- READBREVENT BBSNAME '"'bbs'"' EVENTNR i TAGSSTEM MSGTAGS
- if(rc ~= 0) then
- do
- address(thorport)
- REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
- exit 5
- end
-
- if(filename = MSGTAGS.MSGFILE) then
- do
- /* mark the event as deleted */
-
- UPDATEBREVENT BBSNAME '"'bbs'"' EVENTNR i SETDELETED
- if(rc ~= 0) then
- do
- address(thorport)
- REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
- exit 5
- end
-
- exit
- end
- end
-
- exit
-